home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / prog / mint / netlib / include / iov.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-27  |  736 b   |  40 lines

  1. /*
  2.  *    Definitions to handle io vectors.
  3.  *
  4.  *    11/13/93, kay roemer.
  5.  */
  6.  
  7. #ifndef _IOV_H
  8. #define _IOV_H
  9.  
  10. /* Maximum number of elements in an io vector */
  11. #define IOV_MAX        16
  12.  
  13. struct iovec {
  14.     void    *iov_base;
  15.     long    iov_len;
  16. };
  17.  
  18. #ifndef NOEXTERNS
  19. extern long iov2buf_cpy (char *, long, struct iovec *, short, long);
  20. extern long buf2iov_cpy (char *, long, struct iovec *, short, long);
  21. static long iov_size (struct iovec *, short);
  22.  
  23. static inline long
  24. iov_size (iov, n)
  25.     struct iovec *iov;
  26.     short n;
  27. {
  28.     register long size;
  29.  
  30.     if (n <= 0 || n > IOV_MAX) return -1;
  31.     for (size = 0; n; ++iov, --n) {
  32.         if (iov->iov_len < 0) return -1;
  33.         size += iov->iov_len;
  34.     }
  35.     return size;
  36. }
  37. #endif
  38.  
  39. #endif /* _IOV_H */
  40.